//
//  MyRequestTools.m
//  JinFuThree
//
//  Created by 毛韶谦 on 2018/10/9.
//  Copyright © 2018年 毛韶谦. All rights reserved.
//

#import "MyRequestTools.h"

@implementation MyRequestTools



//  /as/app/financial/api/user/verify-s1
/**
 高级实名认证-基本信息
 
 @param parameters 参数
 @param success 成功返回
 @param failure 失败返回
 */
+ (void)GetAdvancedApproveBasicWithParameters:(NSDictionary *)parameters  Success:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure {
    
    NSString *url = [Common ServicesURL:@"as/app/financial/api/user/verify-s1"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodGet URLString:url parameters:parameters success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
}

//  /as/app/financial/api/user/verify-s1
/**
 高级实名认证-基本信息
 
 @param parameters 参数
 @param success 成功返回
 @param failure 失败返回
 */
+ (void)AdvancedApproveBasicWithParameters:(NSDictionary *)parameters  Success:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure {
    
    NSString *url = [Common ServicesURL:@"as/app/financial/api/user/verify-s1"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodPost URLString:url parameters:parameters success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
}

////as/app/financial/api/user/verify-s2
/**
 高级实名认证-银行卡信息
 
 @param parameters 参数
 @param success 成功返回
 @param failure 失败返回
 */
+ (void)GetAdvancedApproveBankCardWithParameters:(NSDictionary *)parameters  Success:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure {
    
    NSString *url = [Common ServicesURL:@"as/app/financial/api/user/verify-s2"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodGet URLString:url parameters:parameters success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
}
////as/app/financial/api/user/verify-s2
/**
 高级实名认证-银行卡信息
 
 @param parameters 参数
 @param success 成功返回
 @param failure 失败返回
 */
+ (void)AdvancedApproveBankCardWithParameters:(NSDictionary *)parameters  Success:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure {
    
    NSString *url = [Common ServicesURL:@"as/app/financial/api/user/verify-s2"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodPost URLString:url parameters:parameters success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
}


//、/as/app/financial/api/user/contacts
/**
 通讯录保存

 @param parameters 通讯录
 @param success 成功返回
 @param failure 失败返回
 */
+ (void)MyUserContactsWithParameters:(NSDictionary *)parameters  Success:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure {
    
    NSString *url = [Common ServicesURL:@"as/app/financial/api/user/contacts"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodPost URLString:url parameters:parameters success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
}


///as/app/financial/api/user/base
/**
 信息完善-基本信息 拉取
 
 @param parameters 参数
 @param success 成功返回
 @param failure 失败返回
 */
+ (void)MyInfoGetBasicWithParameters:(NSDictionary *)parameters  Success:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure {
    
    NSString *url = [Common ServicesURL:@"as/app/financial/api/user/base"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodGet URLString:url parameters:parameters success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
}


///as/app/financial/api/user/base
/**
 信息完善-基本信息
 
 @param parameters 参数
 @param success 成功返回
 @param failure 失败返回
 */
+ (void)MyInfoBasicWithParameters:(NSDictionary *)parameters  Success:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure {
    
    NSString *url = [Common ServicesURL:@"as/app/financial/api/user/base"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodPost URLString:url parameters:parameters success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
}

//as/app/financial/api/user/address
/**
 信息完善-现居住址 拉取
 
 @param parameters 参数
 @param success 成功返回
 @param failure 失败返回
 */
+ (void)MyInfoGetNowAddressWithParameters:(NSDictionary *)parameters  Success:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure {
    
    NSString *url = [Common ServicesURL:@"as/app/financial/api/user/address"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodGet URLString:url parameters:parameters success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
}

//as/app/financial/api/user/address
/**
 信息完善-现居住址
 
 @param parameters 参数
 @param success 成功返回
 @param failure 失败返回
 */
+ (void)MyInfoNowAddressWithParameters:(NSDictionary *)parameters  Success:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure {
    
    NSString *url = [Common ServicesURL:@"as/app/financial/api/user/address"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodPost URLString:url parameters:parameters success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
}

///as/app/financial/api/user/company
/**
 信息完善-单位信息 拉取
 
 @param parameters 参数
 @param success 成功返回
 @param failure 失败返回
 */
+ (void)MyInfoGetCompanyWithParameters:(NSDictionary *)parameters  Success:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure {
    
    NSString *url = [Common ServicesURL:@"as/app/financial/api/user/company"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodGet URLString:url parameters:parameters success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
}

///as/app/financial/api/user/company
/**
 信息完善-单位信息
 
 @param parameters 参数
 @param success 成功返回
 @param failure 失败返回
 */
+ (void)MyInfoCompanyWithParameters:(NSDictionary *)parameters  Success:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure {
    
    NSString *url = [Common ServicesURL:@"as/app/financial/api/user/company"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodPost URLString:url parameters:parameters success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
}

//as/app/financial/api/user/diplomas
/**
 信息完善-学历信息 拉取
 
 @param parameters 参数
 @param success 成功返回
 @param failure 失败返回
 */
+ (void)MyInfoGetDiplomasWithParameters:(NSDictionary *)parameters  Success:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure {
    
    NSString *url = [Common ServicesURL:@"as/app/financial/api/user/diplomas"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodGet URLString:url parameters:parameters success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
}


//as/app/financial/api/user/diplomas
/**
 信息完善-学历信息
 
 @param parameters 参数
 @param success 成功返回
 @param failure 失败返回
 */
+ (void)MyInfoDiplomasWithParameters:(NSDictionary *)parameters  Success:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure {
    
    NSString *url = [Common ServicesURL:@"as/app/financial/api/user/diplomas"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodPost URLString:url parameters:parameters success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
}


//as/app/financial/api/BankCard
/**
 获取银行卡列表
 @param success 成功返回
 @param failure 失败返回
 */

+(void)getUserBankListDataSuccess:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure{
    
    NSString *url = [Common ServicesURL:@"as/app/financial/api/BankCard"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodGet URLString:url parameters:nil success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
    
}


//as/app/financial/api/BankCard
/**
 添加银行卡
 
 @param parameters 参数
 @param success 成功返回
 @param failure 失败返回
 */
+(void)addBankCardWithParameters:(NSDictionary *)parameters  Success:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure{
    
    NSString *url = [Common ServicesURL:@"as/app/financial/api/BankCard"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodPost URLString:url parameters:parameters success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
    
    
}

//as/app/financial/api/user
/**
 获取个人信息
 
 
 @param success 成功返回
 @param failure 失败返回
 */
+(void)getUserInfoDataSuccess:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure{
    NSString *url = [Common ServicesURL:@"as/app/financial/api/user"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodGet URLString:url parameters:nil success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            
            NSDictionary *tempDic = dataDic[@"data"];

            [AD_UserDefaults setObject:[NSString stringWithFormat:@"%@",tempDic[@"identityCardNumber"]] forKey:ASJFMyUserIdentityCardNumber];
            [AD_UserDefaults setObject:[NSString stringWithFormat:@"%@",tempDic[@"phone"]] forKey:ASJFMyUserInfoAccountKey];
            [AD_UserDefaults setObject:[NSString stringWithFormat:@"%@",tempDic[@"userName"]] forKey:ASJFUserNameKey];
            
            
            [AD_UserDefaults synchronize];
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
}

//as/app/financial/api/BankCard/default/{bankId}
/**
 设银行卡为默认
 
 @param bankId 参数 银行卡id
 @param success 成功返回
 @param failure 失败返回
 */

+(void)setUpBankIsDefaultWithbankId:(NSString *)bankId Success:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure{
    
    NSString *url = [Common ServicesURL:[NSString stringWithFormat:@"as/app/financial/api/BankCard/default/%@",bankId]];
    NSDictionary *paramDic = [NSDictionary dictionaryWithObject:bankId forKey:@"id"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodPut URLString:url parameters:paramDic success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
    
    
}

//as/app/financial/api/BankCard/{bankId}
/**
 解绑银行卡
 
 @param bankId 参数 银行卡id
 @param success 成功返回
 @param failure 失败返回
 */
+(void)unbundleBankWithbankId:(NSString *)bankId Success:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure{
    
    NSString *url = [Common ServicesURL:[NSString stringWithFormat:@"as/app/financial/api/BankCard/%@",bankId]];
    NSDictionary *paramDic = [NSDictionary dictionaryWithObject:bankId forKey:@"bankId"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodPut URLString:url parameters:paramDic success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
    
    
}

//as/app/financial/api/Bank
/**
 获取支持银行卡列表
 @param success 成功返回
 @param failure 失败返回
 */
+(void)getSupportBankListDataSuccess:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure{
    
    NSString *url = [Common ServicesURL:@"as/app/financial/api/Bank"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodGet URLString:url parameters:nil success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
    
}

//as/app/financial/api/user/infoStatus
/**
 用户信息完善情况
 @param success 成功返回
 @param failure 失败返回
 */
+(void)getUserInfoCompleteDataSuccess:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure{
    NSString *url = [Common ServicesURL:@"as/app/financial/api/user/infoStatus"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodGet URLString:url parameters:nil success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
}

//as/app/financial/dictionary
/**
 获取项目枚举
 @param dicKey 参数 枚举类型（婚姻状态marriStatus  收入来源Source_of_income  每月收入  Monthly_income    最高学历education）
 @param success 成功返回
 @param failure 失败返回
 */
+(void)getDicDataWithdicKey:(NSString *)dicKey Success:(nonnull void (^)(_Nullable id responseObject))success Failure:(nonnull void(^)(_Nullable id responseObject,  NSError * _Nullable error))failure{
    
    NSString *url = [Common ServicesURL:@"as/app/financial/dictionary"];
    [[RequestManager manager] HFQDataRequest_Mao:RequestMethodGet URLString:url parameters:[NSDictionary dictionaryWithObject:dicKey forKey:@"dicKey"] success:^(id  _Nullable responseObject) {
        
        NSDictionary *dataDic = responseObject;
        if ([[NSString stringWithFormat:@"%@",dataDic[@"code"]] isEqualToString:@"200"]) {
            
            success(responseObject);
        }else {
            failure(responseObject, nil);
        }
    } failure:^(id  _Nullable responseObject, NSError * _Nullable error) {
        
        failure(responseObject, error);
    }];
    
}






















@end
